package com.speedchina.framework.base;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.speedchina.framework.inter.StandardStructure;
import io.swagger.annotations.ApiModelProperty;
import jdk.nashorn.internal.ir.annotations.Ignore;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import springfox.documentation.annotations.ApiIgnore;

import java.io.Serializable;
import java.util.Date;

/**
 * 基础实体类
 * 实现StandardStructure为字类提供基础字段的set方法
 * @author hank
 * @create 2019-08-26 上午11:34
 **/
public abstract class TEntity<T> extends Model implements StandardStructure {

    /**
     * 数据 范围 过滤的 SQL
     */
    @JsonIgnore
    @TableField(exist = false)
    @ApiModelProperty(hidden = true)
    private String dataFilter;
    /**
     *
     * 高级查询字段
     * 郭
     * @date 2021-07-01 10:30
     **/
    @JsonIgnore
    @TableField(exist = false)
    @ApiModelProperty(hidden = true)
    private String seniorQuery;
    /**
     * 数据 列 过滤的列字段（可用） 逗号分割
     */
    @JsonIgnore
    @TableField(exist = false)
    @ApiModelProperty(hidden = true)
    private String selectColumns;

    public String getDataFilter() {
        return dataFilter;
    }

    public void setDataFilter(String dataFilter) {
        this.dataFilter = dataFilter;
    }

    public String getSelectColumns() {
        return selectColumns;
    }

    public void setSelectColumns(String selectColumns) {
        this.selectColumns = selectColumns;
    }

    public void setCreateTime(Date createTime) {
    }

    public void setUpdateTime(Date updateTime) {
    }

    public void setCreateBy(String createBy) {
    }

    public void setUpdateBy(String updateBy) {
    }

    public String getSeniorQuery() {
        return seniorQuery;
    }

    public void setSeniorQuery(String seniorQuery) {
        this.seniorQuery = seniorQuery;
    }

    @Override
    public String toString() {
        // 用于日志输出时，一般 重写 toString
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
        // StringBuilder str  = new StringBuilder(this.getClass).append("(").append(JSONUtils.toJSONString(this)).append(")");
        // return JSONUtils.toJSONString(this);
        // return super.toString();
    }
}
